package com.wink_172.model

import android.os.Build
import androidx.annotation.RequiresApi
import java.lang.Integer.max

/**
 * @author: fcg
 * @date: 2021-02-22
 * Description:
 */


private val TAG = "Test"
fun main() {
    print("main: ====>>hello main \n")
    var a: Int = 10
    a = a * 10
    print("a=" + a)



    val student= Student("a123",5,"jack",19)
    student.eat()
    doStudy(student)

    val value= lagerNumber(a,3)


    val cellphone1= Cellphone("samsung",1299.3)
    val cellphone2= Cellphone("samsung",1299.3)
    print(cellphone1)
    print("cellphone1 equals cellphone \n"+(cellphone1==cellphone2))

    Singleton.singletonTest()


    val list=listOf("APPLE","ORANGE","PEAR","GRAPE")//不可变集合
    for (fruit in list){
        print(fruit)
    }

    val list02= mutableListOf("APPLE","ORANGE","PEAR","GRAPE")//可变集合
    list02.add("dog")
    for (fruit in list02){
        print(fruit)
    }
//    val maxLengthfruit=list02.maxBy { it.length };

    val set=setOf("APPLE","ORANGE","PEAR","GRAPE")//不可变集合
    for (fruit in set){
        print(fruit)
    }

    val set02= mutableSetOf("APPLE","ORANGE","PEAR","GRAPE")//不可变集合
    for (fruit in set02){
        print(fruit)
    }

    println("\n")
    Thread{
        println("Thread is running====>>")
    }.start()



}

fun doStudy(study: Study){
    study.doHomework()
    study.readBook()
}

@RequiresApi(Build.VERSION_CODES.N)
fun lagerNumber(num1: Int, num2: Int): Int {

    return max(num1, num2)
}

@RequiresApi(Build.VERSION_CODES.N)
fun lagerNumber2(num1: Int,num2: Int):Int= max(num1,num2)


